package midend.IR_Value;

import midend.IR_Type.IR_Const;
import midend.IR_Type.IR_Type;

public class IR_Local_Value extends IR_Value{

    private String Local_Identity;
    private IR_Type Local_Type;
    //计数器 通过数字区分
    private static int Localcounter = 0;
    private int number;

    public IR_Local_Value(String local_Identity, IR_Type local_Type) {
        Local_Identity = local_Identity;
        Local_Type = local_Type;
        this.number = Localcounter++;
    }

    public String get_Local_Identity() {
        return Local_Identity;
    }

    @Override
    public String get_ValueName() {return "%" + get_Local_Identity() + this.number;}

    @Override
    public IR_Type get_Type() {
        return this.Local_Type;
    }

    @Override
    public int get_Const_Type() {
        return IR_Const.IR_Instruction;
    }

    @Override
    public String toString() {
        return "Local_Identity='" + get_ValueName() + '\'' + ", Local_Type=" + Local_Type;
    }
}
